import { Select } from 'antd'
import useAsyncOptions from '../../hooks/useAsyncOptions'

const MySelect = ({ options, value, onChange, ...restItem }) => {
  const { asyncOptions } = useAsyncOptions(options)
  
  return (
    <Select
      options={asyncOptions}
      value={value}
      onChange={onChange}
      mode="multiple"
      tokenSeparators={[',']}
      allowClear
      showSearch
      maxTagCount="responsive"
      { ...restItem }
    />
  )
}

export default MySelect
